/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights
 * reserved. <a>http://www.cqcis.com</a>
 */
package com.cq.bd.dwr;

import java.util.List;
import java.util.Map;

import com.cq.base.domain.Page;
import com.cq.bd.base.BaseDwr;
import com.cq.bd.domain.SFunction;
import com.cq.bd.domain.SFunctionReso;
import com.cq.bd.service.FuncService;

/**
 * 权限管理
 * 
 * @author huangmy
 * @date   2009-10-5
 */
public class FuncDwr extends BaseDwr {
    private static final long serialVersionUID = 1L;
    private FuncService funcService;
    
    /**
     * 创建权限
     * 
     * @param func
     */
    public void createFunc(SFunction func) {
        this.funcService.doCreateFunc(func);
    }
    
    /**
     * 获取该权限下的所有子权限
     * 
     * @param upperFuncId
     * @return
     */
    public List<SFunction> getSubFuncs(Long upperFuncId) {
        return this.funcService.doGetSubFuncs(upperFuncId);
    }
    
    /**
     * 修改权限
     * 
     * @param func
     */
    public void updateFunc(SFunction func) {
        this.funcService.doUpdateFunc(func);
    }
    
    /**
     * 获取权限
     * 
     * @return
     */
    public List<SFunction> getFuncs() {
        return this.funcService.doGetFuncs();
    }
    
    /**
     * 分页查询
     * 
     * @param filter
     * @param like
     * @param sort
     * @param pageNo
     * @param pageSize
     * @return
     */
    public Page pageFuncs(Map<String, String> filter, Map<String, String> like, Map<String, String> sort, int pageNo, int pageSize){
        return this.funcService.pageFuncs(filter, like, sort, pageNo, pageSize);    
    }
    
    /**
     *  修改状态
     * 
     * @param funcId
     * @param state
     */
    public void changeState(Long funcId, int state) {
        this.funcService.doChangeState(funcId, state);
    }
    
    /**
     * 获取权限
     * 
     * @return
     */
    public SFunction getFunc(Long funcId) {
        return this.funcService.doGetFunc(funcId);
    }
    
    /**
     * 关联资源
     * 
     * @param funcReso
     */
    public void createFuncReso(SFunctionReso funcReso) {
        this.funcService.doCreateFuncReso(funcReso);
    }
    
    /**
     * 删除关联
     * 
     * @param funcReso
     */
    public void removeFuncReso(SFunctionReso funcReso) {
        this.funcService.doRemoveFuncReso(funcReso);
    }

    public void setFuncService(FuncService funcService) {
        this.funcService = funcService;
    }
    
}
